package com.zhai.boot.domain.in;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @author Created by 翟凤玺
 * @package com.zhai.boot.domain.in
 * @project-name zhai-boot
 * @description 批量保存交易信息-入参
 * @create-datetime 2020-5-8 16:45
 */
@Data
public class DealBatchSaveIn {

    @Valid
    @NotNull(message = "批量入参不能为空")
    @ApiModelProperty(value = "批量入参")
    private List<DealSaveIn> batch;

    @Data
    public static class DealSaveIn {

        @NotBlank(message = "流水号不能为空")
        @Size(min = 1, max = 20, message = "流水号长度在1-20位")
        @ApiModelProperty(value = "流水号", example ="123", required = true)
        private String serialNum;

        @NotBlank(message = "支付账户不能为空")
        @Size(min = 1, max = 10, message = "支付账户长度在1-10位")
        @ApiModelProperty(value = "支付账户", example ="123", required = true)
        private String account;

        @NotBlank(message = "交易金额不能为空")
        @Pattern(regexp = "^[1-9]{1}\\d*(.\\d{1,2})?$|^0.\\d{1,2}$", message = "交易金额格式有误")
        @ApiModelProperty(value = "交易金额", example ="1.23", required = true)
        private String amount;

        @Size(min = 0, max = 200, message = "备注长度在0-200位")
        @ApiModelProperty(value = "备注", example ="123")
        private String remark;

    }
}
